package com.hotai.comment.yanzheng;

import com.alibaba.fastjson.JSON;
import com.aliyuncs.CommonResponse;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.util.Map;

public class SmsMessageConsumer implements MessageListener {

    public void onMessage(Message message) {

        String jsonString = new String(message.getBody());
        Map<String,String> map = JSON.parseObject(jsonString, Map.class);

        String phone = map.get("phone");//手机号
        String code = map.get("code");//验证码
        System.out.println("手机号："+phone+" 验证码："+code);

        //调用阿里云通信。。。
        CommonResponse commonResponse = SmsUtil.sendSms(phone,code);

    }
}